<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">

<xsl:for-each select="topology/nodes/node">

<xsl:variable name="temp"><xsl:value-of select="software_configuration/@template"/></xsl:variable>
<xsl:variable name="IP"><xsl:value-of select="network_interfaces/interface/ip/@address"/>
</xsl:variable>

<xsl:if test="$temp='debian5_omfAgr'">

#!/bin/bash
#
#questa riga serve a scrivere l'indirizzo esatto del server xmpp openfire nell 'aggregate manager

ssh root@<xsl:value-of select="$IP"/> "sed -i 's/XMPP_ADDRESS/<xsl:value-of select="$IP"/>/g' /etc/omf-expctl-5.2/nodehandler.yaml"

ssh root@<xsl:value-of select="$IP"/> "sed -i 's/XMPP_ADDRESS/<xsl:value-of select="$IP"/>/g' /etc/omf-expctl-5.2/nodehandlerSlave.yaml"

#questa riga modifica la proprietà xmpp.domain di openfire
ssh root@<xsl:value-of select="$IP"/> "sed -i 's/INDIRIZZO_XMPP/<xsl:value-of select="$IP"/>/g' /var/lib/openfire/embedded-db/openfire.script"

#avvio del servizio openfire sull'aggregate manager
ssh root@<xsl:value-of select="$IP"/> "/etc/init.d/openfire start"

ssh root@<xsl:value-of select="$IP"/> "/etc/init.d/omf-aggmgr-5.2 restart"


</xsl:if>

</xsl:for-each>

</xsl:template>
</xsl:stylesheet>
